package training.hari.collections;

import java.util.ArrayList;
import java.util.List;

public class ComparableDemo {
	
	
	

	public static void main(String[] args) {
		
		List<Name> names = new ArrayList<Name>();
		names.add(new Name("hari"));
		names.add(new Name("Praveen"));
		
		System.out.println(names.size());
		System.out.println(names.get(0));
		System.out.println(names.get(1));
		
		//to print all of them, you can write for loop.
		
		names.add(new Name("hari"));
		names.add(new Name("panchanan"));
		names.add(new Name("abc"));
		
		System.out.println(names);
		
		 java.util.Collections.sort(names);
		
		System.out.println(names);
		
		String abc ="hari";
		String xyz="hari";
		

	}

}
